﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace Common.Error
{
    public static class EventLogWriter
    {
        public static void Write(string Entry, EventLogEntryType eventType)
        {
            string logName = "Application";
            EventLog log = new EventLog();
            try
            {
                if (EventLog.SourceExists(logName) == false)
                {
                    EventLog.CreateEventSource(logName, logName);
                }

                log.Source = logName;
                log.WriteEntry(Entry, eventType);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }
}
